//
//  B_MyActivityTVC.m
//  DreamOf
//
//  Created by 薛小刚 on 2018/8/23.
//  Copyright © 2018年 薛小刚. All rights reserved.
//

#import "B_MyActivityTVC.h"
#import "B_ReleaseImageCVC.h"

@implementation B_MyActivityTVC

- (void)awakeFromNib {
    [super awakeFromNib];
    [self setView];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


- (void) setView {
    [self.B_collectionView registerNib:[UINib nibWithNibName:@"B_ReleaseImageCVC" bundle:nil] forCellWithReuseIdentifier:@"B_ReleaseImageCVC"];
}


- (void)setImageArray:(NSArray *)applyArray {
    _applyArray = applyArray;
    [self.B_collectionView reloadData];
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    B_ReleaseImageCVC * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"B_ReleaseImageCVC" forIndexPath:indexPath];
    cell.backgroundColor = [UIColor orangeColor];
    cell.layer.masksToBounds = YES;
    cell.layer.cornerRadius = 15;
    cell.layer.borderColor = [UIColor whiteColor].CGColor;
    cell.layer.borderWidth = 2;
    if ([self.applyArray[indexPath.row] isKindOfClass:[NSString class]]) {
        [cell.B_ImageView sd_setImageWithURL:[NSURL URLWithString:self.applyArray[indexPath.row]]];
    } else {
        cell.B_ImageView.image = self.applyArray[indexPath.row];
    }
    return cell;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return self.applyArray.count;
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
//    if (self.collectionTapAction) {
//        self.collectionTapAction(indexPath);
//    }
}

- (CGSize) collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    return CGSizeMake(30, 30);
}
////两个cell之间的间距（同一行的cell的间距）
//- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
//    return -15;
//}
/// 同一行cell之间的间距
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {
    return -15;
}

//- ( UIEdgeInsets )collectionView:( UICollectionView *)collectionView layout:( UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:( NSInteger )section {
//
//    return UIEdgeInsetsMake(0, -15, 0, 0);
//
//}





- (IBAction)B_watchApplyPeopleAction:(id)sender {
    
    if (self.watchApplePeople) {
        self.watchApplePeople();
        
        }
}
@end
